//初始化数据
let currentText = "首页";
function tabbarinit(currentRole) {
    // if (currentRole > 1) {
    //     return [
    //         {
    //             "current": 0,
    //             "pagePath": "/pages/home/home",
    //             "text": "首页",
    //             "iconPath": "/img/tabBar/homenoraml_icon.png",
    //             "selectedIconPath": "/img/tabBar/homehigh_icon.png",
    //             "number": 0
    //         },
    //         {
    //             "current": 0,
    //             "pagePath": "/pages/activity/activityList",
    //             "text": "分类",
    //             "iconPath": "/img/tabBar/yjzfnormal_icon.png",
    //             "selectedIconPath": "/img/tabBar/yjzfhigh_icon.png",
    //             "number": 0
    //         },
    //         {
    //             "current": 0,
    //             "pagePath": "/pages/report/report",
    //             "text": "购物车",
    //             "iconPath": "/img/tabBar/middle_icon.png",
    //             "selectedIconPath": "/img/tabBar/middlehigh_icon.png",
    //             "number": 0
    //         },
    //         {
    //             "current": 0,
    //             "pagePath": "/pages/message/message",
    //             "text": "消息",
    //             "iconPath": "/img/tabBar/msgnoraml_icon.png",
    //             "selectedIconPath": "/img/tabBar/msghigh_icon.png",
    //             "number": 0
    //         },
    //         {
    //             "current": 0,
    //             "pagePath": "/pages/mine/mine",
    //             "text": "我的",
    //             "iconPath": "/img/tabBar/minenoraml_icon.png",
    //             "selectedIconPath": "/img/tabBar/minehigh_icon.png",
    //             "number": 0
    //         }
    //     ]
    // } else {
    return [
        {
            "current": 0,
            "pagePath": "/pages/home/home",
            "text": "首页",
            "iconPath": "/img/tabBar/homenoraml_icon.png",
            "selectedIconPath": "/img/tabBar/homehigh_icon.png",
            "number": 0
        },
        {
            "current": 0,
            "pagePath": "/pages/activity/activityList",
            "text": "分类",
            "iconPath": "/img/tabBar/yjzfnormal_icon.png",
            "selectedIconPath": "/img/tabBar/yjzfhigh_icon.png",
            "number": 0
        },
        {
            "current": 0,
            "pagePath": "/pages/newList/newList",
            "text": "购物车",
            "iconPath": "/img/tabBar/middle_icon.png",
            "selectedIconPath": "/img/tabBar/middlehigh_icon.png",
            "number": 0
        },
        {
            "current": 0,
            "pagePath": "/pages/mine/mine",
            "text": "我的",
            "iconPath": "/img/tabBar/minenoraml_icon.png",
            "selectedIconPath": "/img/tabBar/minehigh_icon.png",
            "number": 0
        }
    ]
    // }


}

/**
 * tabbar主入口
 * @param  {String} bindName
 * @param  {[type]} id       [表示第几个tabbar，以0开始]
 * @param  {[type]} target   [当前对象]
 */
function tabbarmain(bindName = "tabdata", id, target, notReadNum, currentRole = null) {
    // console.error("JJLog:roel是:" + currentRole);
    var that = target;
    var bindData = {};
    var otabbar = tabbarinit(currentRole);
    otabbar[id]['iconPath'] = otabbar[id]['selectedIconPath']//换当前的icon
    otabbar[id]['current'] = 1;
    otabbar[2].number = notReadNum
    bindData[bindName] = otabbar;
    that.setData({ bindData });
}


module.exports = {
    tabbar: tabbarmain
}